import { addInsuranceBlack, editInsuranceBlack, exportInsuranceBlackList, getInsuranceBlackList } from '@/api/insurance/black'
import type { BlackDto } from '@/api/insurance/black/types'
import type { PageDto } from '@/api/types'
import renderModal, { getModelValue, initModelValue, type FormModalDto } from '@/components/modal/Modal'
import type { FilterDto } from '@/render/FilterRender'
import TableRender, { renderSlotButtons, type TableRenderColumnTypes } from '@/render/TableRender'
import type { AnyObject } from '@/types'
import toNative from '@/utils/toNative'
import { downloadFile } from '@/utils/util'
import { message } from 'ant-design-vue'
import { Component } from 'vue-facing-decorator'
import { CompanyBlack } from '../company/Index'

@Component
export class PersonBlack extends CompanyBlack {
    type = 2
    listType = 3
    
    tableColumnConfig() {
        const config = super.tableColumnConfig()
        config[0].title = '员工姓名'
        config.splice(2, 1)
        config.splice(1, 0, {
            field: 'idCardNo',
            title: '员工身份证号',
        })
        return config
    }
    initFormConfig() { 
        const config = super.initFormConfig()
        return {
            ...config,
            items: {
                id: {
                    name: '',
                    element: 'none',
                    hidden: true
                },
                type: {
                    name: '类别',
                    element: 'radioGroup',
                    value: 2,
                    placeholder: '请输入报案公司名称',
                    readonly: true,
                    options: [
                        {
                            label: '客户',
                            value: 0
                        },
                        {
                            label: '派遣单位',
                            value: 1
                        },
                        {
                            label: '投保人员',
                            value: 2
                        },
                    ],
                    required: true
                },
                name: {
                    name: '姓名',
                    element: 'input',
                    placeholder: '请输入员工姓名',
                    required: true
                },
                idCardNo: {
                    name: '身份证',
                    element: 'input',
                    placeholder: '请输入员工身份证',
                    required: true
                },
                reason: {
                    name: '录入原因',
                    element: 'textarea',
                    placeholder: '请输入录入原因',
                    optionsType: 'company',
                    required: true
                },
                file: {
                    name: '上传附件',
                    element: 'upload',
                    required: true,
                    params: {
                        base64: true,
                        listType: 'picture-card',
                        accept: '.png,.jpg,.jpeg',
                        suffix: (
                            <div class="text-sm text-gray">
                                大小限制5MB，支持png、jpeg、jpg格式文件
                            </div>
                        )
                    }
                },
            }
        } as FormModalDto

    }
}

export default toNative(PersonBlack)